package org.tity.commons.io;

import static org.junit.Assert.assertTrue;

import java.io.FileInputStream;

import org.junit.Test;
import org.tity.commons.environment.PathTool;

public class StreamUtil_A {

	private FileInputStream getInputStream() throws Exception {
		return PathTool.getDir(this.getClass()).resolve("test.txt").getInputStream();
	}
	
	private String getText() throws Exception {
		return PathTool.getDir(this.getClass()).resolve("test.txt").getStringContent();
	}
	
	
	@Test
	public void text_outstream_string() throws Exception {
		FileInputStream in=this.getInputStream();
		String str=StreamUtil.input2string(in, "UTF-8");
		assertTrue(str.equals(getText()));
	}
	
}
